package org.travel.app.controller;
import lombok.RequiredArgsConstructor;
import org.springframework.web.bind.annotation.*;
import org.travel.app.common.vo.ResultVO;
import org.travel.app.entity.IdVerification;
import org.travel.app.entity.spots.SpotsReservation;
import org.travel.app.service.impl.ReservationImpl;
import org.travel.app.service.impl.UserServiceImpl;

/**
 * @author nmm
 * @date 2024-12-2024/12/22
 * @deriction njm......
 */
@RequestMapping("/reservation")
@RestController
@RequiredArgsConstructor
public class ReservationController extends BaseController {
    private final ReservationImpl reservationService;
    private final UserServiceImpl userService;

    /**
     * 添加预约游客的个人信息
     * @param reservationUser
     * @return
     */
    @PostMapping("/saveReservationUser")
    public ResultVO saveReservationUser(@RequestBody IdVerification reservationUser) {
        userService.addReservationUser(reservationUser);
        return success();
    }


    /**
     * 添加预约信息并生成订单返回
     * @param spotsReservation
     * @return
     */
    @PostMapping("/saveReservation")
    public ResultVO getReservationOrder(@RequestBody SpotsReservation spotsReservation) {
            return success(reservationService.saveReservation(spotsReservation));
    }

}